import React from 'react'
import { Modal, Button, Form, Input, Steps, Row, Col } from 'antd'
import Step0 from '../steps/Step0'
import Step1 from '../steps/Step1'
import Step2 from '../steps/Step2'

const Step = Steps.Step
const BindSteps = ({user,bindUserStep, bindUserItem, roleItems, roleIds, currentItem, dispatch, ...bindModalProps}) => {
  const prev = () => {
    dispatch({
      type: 'bindUser/setStep',
      payload: 'decrement'
    })
  }

  const next = () => {
    dispatch({
      type: 'bindUser/setStep',
      payload: 'increment'
    })
  }

  const ColProps = {
    span: 1,
  }

  return (
    <Modal {...bindModalProps}>
      <Steps current={bindUserStep}>
        <Step title="查找" description="查找用户"/>
        <Step title="确定" description="确定用户信息"/>
      </Steps>

      {
        bindUserStep === 0 &&
        <Step0 user = {user} next={next} dispatch={dispatch}/>
      }

      {
        bindUserStep === 1 &&
        <Step1 next={next} prev={prev} dispatch={dispatch} bindUserItem={bindUserItem} roleItems={roleItems} currentItem={currentItem}/>
      }
    </Modal>
  )
}

export default BindSteps
